package code.main.core.mvc
{
	import code.structure.manager.tips.BaseTips;
	import code.tools.commponents.Component;
	
	import flash.display.DisplayObjectContainer;
	import flash.events.MouseEvent;
	
	/**
	 *项目中所有视图的基类 
	 * @author Yuri
	 * 
	 */
	public class YSprite extends Component
	{
		protected var _bindTip:BaseTips;
		public function YSprite(parent:DisplayObjectContainer,xpos:Number = 0,ypos:Number = 0)
		{
			super(parent,xpos,ypos);
			initMouseListeners();
		}
		
		private function initMouseListeners():void
		{
			// TODO Auto Generated method stub
			this.addEventListener(MouseEvent.MOUSE_OVER,onOverHandler);
			this.addEventListener(MouseEvent.MOUSE_OUT,onOutHandler);
		}
		
		protected function onOutHandler(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			
		}
		
		protected function onOverHandler(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
//			if(_bindTip) _bindTip.show(null,this,
		}
		
		/**
		 *移除所有子对象 
		 * 
		 */
		public function removeAllChild():void{
			while(this.numChildren>0){
				this.removeChildAt(0);
			}
		}

		/**
		 * 绑定的tip
		 */
		public function get bindTip():BaseTips
		{
			return _bindTip;
		}

		public function set bindTip(value:BaseTips):void
		{
			_bindTip = value;
		}


	}
}